DataVis LA Intro

Szilárd Pafka, PhD
Chief Scientist, Epoch

DataVis LA meetup
Nov 2013

x <- 1:4
gr <- c("a","a","b","b")
y <- x + rnorm(4)
d <- data.frame(gr, x, y)
print(d)
  gr x      y
1  a 1 0.6412
2  a 2 2.7852
3  b 3 1.7314
4  b 4 5.9027
md <- lm(y ~ x, d)


d <- read.csv("data/gapminder.csv", sep="\t")


  • Country
  • Year
  • Population
  • Continent
  • Life expectancy
  • GDP per capita
ggplot() + geom_point(data = d, mapping = aes(x = gdpcap, y = lifeexp))

plot of chunk unnamed-chunk-5

ggplot(d) + geom_point(aes(x = gdpcap, y = lifeexp)) + scale_x_log10()

plot of chunk unnamed-chunk-6

ggplot(d) + geom_point(aes(x = gdpcap, y = lifeexp, color = contin)) + scale_x_log10()

plot of chunk unnamed-chunk-7

ggplot(d) + geom_point(aes(x = gdpcap, y = lifeexp, color = contin, size = pop)) + scale_x_log10()

plot of chunk unnamed-chunk-8

ggplot(d) + geom_point(aes(x = gdpcap, y = lifeexp, color = contin, size = pop)) + scale_x_log10() + scale_size(range = c(2,10))

plot of chunk unnamed-chunk-9

ggplot(d) + geom_point(aes(x = gdpcap, y = lifeexp, color = contin, size = pop)) + scale_x_log10() + scale_size(range = c(2,10)) + facet_wrap( ~ yr)

plot of chunk unnamed-chunk-10

plot of chunk unnamed-chunk-11